// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store

const api = {
  /**
   * 查询理货员
   */
  queryWorkPeople (params) {
    return Service.get(
      `/${ServiceName}/api/external/DispatchWorkerController/queryWorkPeople`
    )
  },
  /**
   * 查询检尺员
   */
  queryPeople (params) {
    return Service.get(
      `/${ServiceName}/api/external/DispatchWorkerController/queryPeople`
    )
  },
  /**
   * 新增理货员
   */
  insertTallyClerk (params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/DispatchWorkerController/insertTallyClerk`, params
    )
  },
  /**
   * 新增指导员
   */
  insertRuler (params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/DispatchWorkerController/insertRuler`, params
    )
  },
  /**
   * 查询主列表
   */
  queryByPlanType (params) {
    return Service.get(
      `/${ServiceName}/api/external/DispatchWorkerController/queryByPlanType`, {params}
    )
  },
  /**
   * 回显
   */
  queryById (params) {
    return Service.get(
      `/${ServiceName}/api/external/DispatchWorkerController/queryById`, {params}
    )
  },
  /**
   * 新增场地
   */
  insertStorehouse (params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/DispatchWorkerController/insertStorehouse`, params
    )
  },
  /**
   * 查询场地
   */
  queryApplication (params) {
    return Service.get(
      `/${ServiceName}/api/external/DispatchWorkerController/queryApplication?id=${params}`
    )
  },
  /**
   * 保存外理单位
   */
   insertForeignTallyCompany (params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/DispatchWorkerController/insertForeignTallyCompany`, params
    )
  },
  /**
   * 回显外理单位
   */
   queryForeignTallyByPlanId (params) {
    return Service.get(
      `/${ServiceName}/api/external/DispatchWorkerController/queryForeignTallyByPlanId?planId=${params}`
    )
  },
}
export default api